<!--
* @description 公共填报页面 主页
* @fileName index.vue
* @author zero_fsc
* @date 2020/05/13 14:38:41
!-->
<template>
  <card-page
    :writePage="writePageConfig"
    :prjInfo="prjInfo"
    @init-state="getInitState"
  />
</template>

<script>
import cardPage from './src/card'
import { deepClone } from '@/utils'
export default {
  components: {
    cardPage
  },
  data () {
    return {
      writePageConfig: null,
      prjInfo: {}
    }
  },
  created () {
    this.getConfigQuery()
  },
  methods: {
    getConfigQuery () {
      this.$nextTick(() => {
        let query = JSON.parse(this.$route.query.data)
        if (
          query &&
          Object.prototype.toString.call(query.configList) === '[object Array]'
        ) {
          this.writePageConfig = deepClone(query.configList)
        }
      })
    },
    getInitState (val) {
      if (val) {
        this.$router.back()
      }
    }
  }
}
</script>
